package com.nbicc.survey.service.impl;

import com.nbicc.parent.serivce.BaseService;
import com.nbicc.survey.po.Topic;
import com.nbicc.survey.service.IEssayQuestionTopicService;
import com.nbicc.survey.service.IMultipleChoiceTopicService;
import com.nbicc.survey.service.IMultipleSelectionTopicService;
import com.nbicc.survey.service.ITopicService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

@Service("TopicServiceImpl")
public class TopicServiceImpl extends BaseService implements ITopicService {

    @Resource(name = "EssayQuestionTopicServiceImpl")
    private IEssayQuestionTopicService essayQuestionTopicService;
    @Resource(name = "MultipleChoiceTopicServiceImpl")
    private IMultipleChoiceTopicService multipleChoiceTopicService;
    @Resource(name = "MultipleSelectionTopicServiceImpl")
    private IMultipleSelectionTopicService multipleSelectionTopicService;

    @Override
    public Topic selectById(String id) {
        Topic topic;
        topic = multipleChoiceTopicService.selectById(id);
        if(topic == null){
            topic = multipleSelectionTopicService.selectById(id);
            if(topic == null){
                topic = essayQuestionTopicService.selectById(id);
            }
        }
        return topic;
    }
}
